﻿package com.pool.core 
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import org.dm.display.DisplayMgr;
	import org.dm.general.ClassGather;
	import SpLib.ObjSys.NetObjC;
	
	/**
	 * ...
	 * @author Scott
	 */
	public class MinDesk extends Sprite
	{
		private var _display:Sprite;
		
		private var _deskName:TextField;
		private var _deskNameText:String="天字一号";
		private var _desk:Bitmap;
		private var _deskMask:Sprite;
		private var _leftHand:MovieClip
		private var _rightHand:MovieClip;
		
		private var w:Number = 41;
		private var h:Number = 27.5;
		
		
		public function MinDesk(px:Number=0,py:Number=0) 
		{
			super();
			
			_display = new Sprite();
			_display.addChild(ClassGather.getInstance("btn.DeskBg"));
			
			_deskMask = new Sprite();
			_deskMask.graphics.beginFill(0xff);
			_deskMask.graphics.drawRect(0, 0,103, 75);
			_deskMask.graphics.endFill();
			_deskMask.x = w;
			_deskMask.y = h;
			
			var pp:BitmapData = new (ClassGather.getClass("btn.DeskImg"))(0,0);
			_desk = new Bitmap(pp);
			_desk.x = w;
			_desk.y = h;
			_display.addChild(_desk);
			_desk.mask = _deskMask;
			
			
			_deskName = new TextField();
			_deskName.embedFonts = true;
			_deskName.selectable = false;
			_deskName.defaultTextFormat = new TextFormat("fanzhen", 11, 0xFFFFFF);
			_deskName.x = 70;
			_deskName.y = 110;
			_deskName.text = _deskNameText;
			_display.addChild(_deskName);
			
			setx(px);
			sety(py);
			
			_leftHand = DisplayMgr.getDisplay("desks.leftHand", "btn.ReadyHand");
			_rightHand = DisplayMgr.getDisplay("desks.rightHand", "btn.ReadyHand");
		}
		
		public function get display():Sprite 
		{ 
			return _display; 
		}
		
		public function setx(value:Number):void
		{
			_display.x = value;
			_deskMask.x = value + _desk.x;
		}
		
		public function sety(value:Number):void
		{
			_display.y = value;
			_deskMask.y = value + _desk.y;
		}
	}

}